package com.abcode.userserver.client.controller;

import com.abcode.userserver.client.service.SysUserService;
import com.abcode.userserver.common.constant.Constant;
import com.abcode.userserver.common.vo.ResultVO;
import com.abcode.userserver.entity.SysUserBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author:Andy.Yang
 * @Date:2019/4/25 0025
 */
@RestController
@RequestMapping("/user")
public class SysUserController {

  @Autowired
  private SysUserService sysUserService;

  @RequestMapping("/login")
  public ResultVO login(String fusername,String fpassword) {
    return sysUserService.login(fusername, fpassword);
  }

  @RequestMapping("/save_user")
  public ResultVO saveUser(SysUserBean bean){
    if(sysUserService.saveUser(bean)) {
      return new ResultVO("操作成功");
    }else{
      return new ResultVO(Constant.ReturnStatusCode.REPEAT,"用户名已存在");
    }
  }
}
